package com.ia2011.project1.math;

import java.awt.Point;
import java.util.Random;

import com.ia2011.project1.domain.Constants;

public class Utils {

	final static public Integer getDistance(Point i, Point j) {
			return (Math.abs(i.x - j.x) + Math.abs(i.y - j.y));
	}
	
	final static public Integer getUniformDistribution(Integer num) {
		Random rnd = new Random();
		return Math.abs(rnd.nextInt(num));
	}
	
	/**
	 * Get time for distance in minutes
	 * @param distance
	 * @return time for distance in minutes
	 */
	final static public Double getTime(double distance) {
		return ((distance/1000)/Constants.MAX_SPEED)*60; // get distance in km
	}
}
